// pages/locale-selector-comp/locale-selector-comp.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    from:"",
    to:"",
  },

  /**
   * 组件的初始数据
   */
  data: {
    from: "所有",
    to: "所有",
    active: 0,
    main_campus: {
      canteens: ["东一食堂", "东三食堂", "紫荆园", "集锦园", "东华园", "百景园", "西二食堂", "西一食堂"],
      dorms: ["沁苑", "紫菘", "研究生公寓", "博士生公寓"],
      academics: ["西十二", "西五", "南一楼", "电气大楼", "西八楼"],
    },
    east_campus: {
      canteens: ["韵苑食堂", "学一食堂", "学二食堂", "CBD", "东园食堂", "必胜客"],
      dorms: ["韵苑5栋", "韵苑25栋", "教职工宿舍"],
      academics: ["东九楼", "东十二", "工程中心", "生科院"],
    },
  },



  /**
   * 组件的方法列表
   */
  methods: {
    fromTap(e) {
      console.log("出发地")
      console.log(e.currentTarget.dataset.val);
      var pageStack = getCurrentPages();
      var currentPage = pageStack[pageStack.length - 1];
      this.setData({
        from:e.currentTarget.dataset.val
      })
      // currentPage.setData({
      //   from: e.currentTarget.dataset.val
      // })
      this.selectComponent('#fromItem').toggle();
      currentPage.onShow()
    },

    toTap(e){
      console.log("目的地")
      console.log(e.currentTarget.dataset.val);
      var pageStack = getCurrentPages();
      var currentPage = pageStack[pageStack.length - 1];
      this.setData({
        to:e.currentTarget.dataset.val
      })
      // currentPage.setData({
      //   to: e.currentTarget.dataset.val
      // })
      this.selectComponent('#toItem').toggle();
      currentPage.onShow()
    },

  }
})